# $Id$
# Contributor: Kevin <kevin@archlinux.org>
# Contributor: criminy <criminy@gmail.com>

pkgbase=cairomm
pkgname=(cairomm cairomm-docs)
pkgver=1.12.2
pkgrel=2
pkgdesc="C++ bindings for Cairo"
url="https://www.cairographics.org/cairomm/"
arch=(i686 x86_64)
license=(LGPL MPL)
depends=(cairo libsigc++)
makedepends=(git mm-common)
_commit=e9ef515b7b8db5b4f024ddfefe5dfc03f2b8ccea  # tags/v1.12.2^0
source=("git+https://anongit.freedesktop.org/git/cairomm#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgbase
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgbase
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgbase
  ./configure --prefix=/usr --enable-maintainer-mode
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package_cairomm() {
  cd $pkgbase
  sed -i -e 's/^doc_subdirs/#doc_subdirs/' Makefile
  make DESTDIR="$pkgdir" install
}

package_cairomm-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  cd $pkgbase
  make -C docs DESTDIR="$pkgdir" install
}
